.TH C++SIM 3A "23rd December 2016" "C++SIM" "C++SIM Reference Manual"
.SH NAME
UniformStream, Draw, ExponentialStream, ErlangStream, HyperExponentialStream, NormalStream \- various pseudo-random number generators.
.SH SYNOPSIS
.B "#ifndef RANDOM_H_"
.br
.B "#   include <ClassLib/Random.h>"
.br
.B "#endif"
.sp
.BI "class Draw"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	Draw (double p, int StreamSelect = 0);"
.br
.BI "	virtual Boolean operator() ();
.br
.BI "};"

.BI "class UniformStream : public RandomStream"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	UniformStream (double lo, double hi,"
.br
.BI "                    int StreamSelect = 0);"
.br
.BI "	virtual double operator() ();"
.br
.BI "};"

.BI "class ExponentialStream : public RandomStream"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	ExponentialStream (double Mean,"
.br
.BI "	                   int StreamSelect = 0);"
.br
.BI "	virtual double operator() ();"
.br
.BI "};"

.BI "class ErlangStream : public RandomStream"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	ErlangStream (double Mean, double StdDev,"
.br
.BI "	              int StreamSelect = 0);"
.br
.BI "	virtual double operator() ();"
.br
.BI "};"

.BI "class HyperExponentialStream : public RandomStream"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	HyperExponentialStream (double Mean, double StdDev,"
.br
.BI "	                        int StreamSelect = 0);"
.br
.BI "	virtual double operator() ();"
.br
.BI "};

.BI "class NormalStream : public RandomStream"
.br
.BI "{"
.br
.BI "public:"
.br
.BI "	NormalStream (double Mean, double StdDev,"
.br
.BI "	              int StreamSelect = 0);"
.br
.BI "	virtual double operator() ();"
.br
.BI "};"
.SH DESCRIPTION
These classes provide pseudo-random number generators based upon the
algorithm provided by RandomStream(3A).

All of their constructors have a default (last) parameter which, if given an
integer value
.B n 
can be used to "discard" the first
.B n 
random numbers taken from the base algorithm.

With the exception of 
.B Draw
they all have a single public method 
.B operator() 
which returns a random number drawn from the relevant distribution.

.B Draw
returns TRUE with the probability given in the first parameter.

.B UniformStream 
returns a number from a uniform distribution with the lower bound of
.B lo 
and an upper bound of
.B hi 
inclusive.

.B ExponentialStream 
returns a number from an exponential distribution with 
.B Mean
as the mean.

.B ErlangStream 
returns a number from an Erlang distribution with a mean of
.B Mean 
and 
.B StdDev
as its standard deviation.

.B HyperExponential 
returns a number from a hyperexponential distribution with a mean
of
.B Mean 
and
.B StdDev 
as its standard deviation.

.B Normal 
returns a number from a normal distribution with a mean of
.B Mean 
and
.B StdDev 
as its standard deviation.
.SH NOTES
All of the various stream constructors have two other default parameters, the MGSeed and LCGSeed. This is because the Uniform stream uses the linear congruential generator (seed is LCGSeed, with the default value of 1878892440L) based on the algorithm in link:http://algs4.cs.princeton.edu/home/[this text], and the results of this are shuffled with the multiplicative generator (seed is MGSeed, with a default value of 772531L) as suggested by [Maclaren and Marsaglia], to obtain a sufficiently uniform random distribution. These values can be changed but be careful.
.SH SEE ALSO
RandomStream(3A)
